import { Injectable } from '@angular/core';
import { RequestClass } from './request.service';
@Injectable()
export class StatisticsService {
    constructor(private requestclass: RequestClass) {}
    /**
     * 监测井安装量
     * @returns
     */
    // 仍在使用的旧接口
    fetchInstalled = async () => {
        return await this.requestclass.request.get('/home/getwellStatusCounts');
    };
    /**
     * 全年指标
     * @param {number} year 年份
     * @returns
     */
    fetchTarget = async ({ year }) => {
        return await this.requestclass.request.get('/chart/info', {
            params: {
                year,
            },
        });
    };

    /**
     * 统计报表列表
     * @param {string} place 村庄乡镇
     * @param {string} type 月季年
     * @param {number} time yyyy-mm-dd yyyy-mm yyyy yyyy-season-x
     * @returns
     */
    fetchStatisticsList = async ({ type, time, place }) => {
        return await this.requestclass.request.get('/statistics', {
            params: {
                type,
                time,
                place,
            },
        });
    };
}
